/*
 * Copyright 2006-2022 ahtelit.com, All Rights Reserved.
 */

package com.telit.firecommand.feign;

import com.telit.android.dto.CommMsgCenterLogDTO;
import com.telit.android.dto.IssueFireVerificationTask;
import com.telit.android.dto.PushFireMsg;
import com.telit.common.constant.Constant;
import com.telit.common.entity.DataReturn;
import com.telit.common.entity.PageData;
import com.telit.firecommand.dto.FireQueryListDTO;
import com.telit.firecommand.entity.CommFireAlarm;
import com.telit.firecommand.feign.factory.RemoteFirecommandServiceFallbackFactory;
import com.telit.firecommand.model.sysUser.UpdateUserRequest;
import com.telit.firecommand.vo.ForesterVO;
import com.telit.firecommand.vo.MicroSysUserVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * firecommand feign
 *
 * @author yuezhuang
 * @since 2022-12-14
 */
@FeignClient(contextId = "remoteFirecommandService", name = "yichang-firecommand", fallbackFactory = RemoteFirecommandServiceFallbackFactory.class)
public interface RemoteFirecommandService {

    @GetMapping(value = "/firecommand/uav_user/listByFireId", produces = "application/json;charset=UTF-8")
    DataReturn uavInfoByFireId(@RequestParam("fireId") Long fireId, @RequestParam("userId") Long userId);

    @GetMapping(value = "/firecommand/district/getNameFromCode", produces = "application/json;charset=UTF-8")
    @ApiOperation("根据行政区划code查询名称")
    DataReturn getNameFromCode(@RequestParam("code") String code);

    @PostMapping(value = "/firecommand/msg-center/addBatch", produces = "application/json;charset=UTF-8")
    @ApiOperation("消息中心-批量消息新增")
    DataReturn addBatch(@RequestBody CommMsgCenterLogDTO dto);

    @GetMapping(value = "firecommand/fire-query/queryAddressById", produces = "application/json;charset=UTF-8")
    @ApiOperation("/根据火情id查询详细地址以及行政地址")
    DataReturn queryAddressById(@RequestParam("fireId") String fireId);

    @GetMapping(value = "/firecommand/event/detail/{id}", produces = "application/json;charset=UTF-8")
    @ApiOperation("查询事件详情")
    DataReturn detail(@PathVariable(value = "id") String id);

    @GetMapping(value = "/firecommand/fire-query/queryLongitudeAndLatitude", produces = "application/json;charset=UTF-8")
    @ApiOperation("根据火情id查询经纬度")
    DataReturn queryLongitudeAndLatitude(@RequestParam("fireId") String fireId);

    @PostMapping(value = "/firecommand/fire-disposal/addFireDispose", produces = "application/json;charset=UTF-8")
    @ApiOperation("添加火情处置信息")
    DataReturn addFireDispose(@RequestBody PushFireMsg pushFireMsg);

    @PostMapping(value = "/firecommand/fire-disposal/addTaskDispose", produces = "application/json;charset=UTF-8")
    @ApiOperation("添加火情核实任务处置信息")
    DataReturn addTaskDispose(@RequestBody IssueFireVerificationTask issueFireVerificationTask);

    @GetMapping("/firecommand/geo-xzqh-cun/getDistrictByPoint")
    @ApiOperation("根据点查看村级行政区划名称和编码")
    DataReturn getDistrictNameAndCodeByPoint(@RequestParam(value = "longitude") String longitude,
                                             @RequestParam(value = "latitude") String latitude);

    @ApiOperation(httpMethod = Constant.REQUEST_METHOD_POST, value = "更新用户信息")
    @PostMapping(path = "/firecommand/sys-user/update")
    DataReturn<MicroSysUserVO> updateUser(@RequestBody UpdateUserRequest updateUserRequest);

    @GetMapping(value = "/firecommand/fire-query/queryFireByPage")
    @ApiOperation("分页查询预警监测查询火情列表")
    DataReturn<PageData<List<CommFireAlarm>>> queryFireByPage(@SpringQueryMap FireQueryListDTO fireQueryListDTO);

    @GetMapping(value = "/firecommand/fire-query/queryAllHistoryFire")
    @ApiOperation("条件查询所有历史火情,默认查询全部")
    DataReturn<PageData<List<CommFireAlarm>>> queryAllHistoryFire(@RequestParam(required = false) String startTime,
                                                                  @RequestParam(required = false) String endTime,
                                                                  @RequestParam(required = false) String districtCode,
                                                                  @RequestParam(required = false) String fireLevel,
                                                                  @RequestParam(required = false) String resource,
                                                                  @RequestParam(required = false) Integer page,
                                                                  @RequestParam(required = false) Integer rows);

    @GetMapping(value = "/firecommand/fire-query/queryAllFireByCondition")
    @ApiOperation("条件查询所有火情,默认查询全部")
    DataReturn<PageData<List<CommFireAlarm>>> queryAllFireByCondition(@RequestParam(required = false) String status,
                                                                      @RequestParam(required = false) String startTime,
                                                                      @RequestParam(required = false) String endTime,
                                                                      @RequestParam(required = false) String districtCode,
                                                                      @RequestParam(required = false) String resource,
                                                                      @RequestParam(required = false) String action,
                                                                      @RequestParam(required = false) String finalLevel,
                                                                      @RequestParam(required = false) Integer pageNum,
                                                                      @RequestParam(required = false) Integer pageSize);

    @GetMapping(value = "/firecommand/sys-user/qry-list")
    @ApiOperation("分页查询用户列表")
    DataReturn<PageData<List<ForesterVO>>> qryUserList(@RequestParam(required = false) String name,
                                                       @RequestParam(required = false) Integer onlineStatus,
                                                       @RequestParam(value = "regionCode", required = false) String regionCode,
                                                       @RequestParam(value = "areaRecursion", required = false, defaultValue = "false") boolean areaRecursion,
                                                       @RequestParam(value = "roleCodes", required = false) String roleCodes,
                                                       @RequestParam(value = "ids", required = false) String ids,
                                                       @RequestParam(value = "current", defaultValue = "1") Integer current,
                                                       @RequestParam(value = "size", defaultValue = "20") Integer size);

    @GetMapping(value = "/firecommand/sys-user/qry-id-list")
    @ApiOperation("查询用户id列表")
    DataReturn<List<Long>> qryUserIdList(@RequestParam(required = false) String name,
                                         @RequestParam(required = false) Integer onlineStatus,
                                         @RequestParam(value = "regionCode", required = false) String regionCode,
                                         @RequestParam(value = "areaRecursion", required = false, defaultValue = "false") boolean areaRecursion,
                                         @RequestParam(value = "roleCodes", required = false) String roleCodes);

    @GetMapping(value = "/firecommand/sys-user/detail/{id}")
    @ApiOperation("查询用户详情")
    DataReturn<ForesterVO> qryUserDetail(@PathVariable(value = "id") Long id);

    @GetMapping(value = "/firecommand/forester/count")
    @ApiOperation("查询护林员数量")
    DataReturn countForesterByCondition(@RequestParam(value = "name") String name,
                                        @RequestParam(value = "districtCode") String districtCode);

}
